package com.zc.web.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zc.common.utils.DateUtils;
import com.zc.web.domain.DailyReflection;
import com.zc.web.mapper.DailyReflectionMapper;
import com.zc.web.service.IDailyReflectionService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 每日感悟Service业务层处理
 *
 * @author zc
 * @date 2025-09-29
 */
@Service
public class DailyReflectionServiceImpl extends ServiceImpl<DailyReflectionMapper, DailyReflection> implements IDailyReflectionService
{
    @Autowired
    private DailyReflectionMapper dailyReflectionMapper;

    /**
     * 查询每日感悟
     *
     * @param id 每日感悟主键
     * @return 每日感悟
     */
    @Override
    public DailyReflection selectDailyReflectionById(Long id)
    {
                return getById(id);
    }

    /**
     * 查询每日感悟列表
     *
     * @param dailyReflection 每日感悟
     * @return 每日感悟
     */
    @Override
    public List<DailyReflection> selectDailyReflectionList(DailyReflection dailyReflection)
    {
        return dailyReflectionMapper.selectDailyReflectionList(dailyReflection);
    }

    /**
     * 新增每日感悟
     *
     * @param dailyReflection 每日感悟
     * @return 结果
     */
    @Override
    public int insertDailyReflection(DailyReflection dailyReflection)
    {
        dailyReflection.setCreateTime(DateUtils.getNowDate());
        return save(dailyReflection) == true? 1 : 0;
    }

    /**
     * 修改每日感悟
     *
     * @param dailyReflection 每日感悟
     * @return 结果
     */
    @Override
    public int updateDailyReflection(DailyReflection dailyReflection)
    {
        dailyReflection.setUpdateTime(DateUtils.getNowDate());
        return updateById(dailyReflection) == true ? 1 : 0;
    }

    /**
     * 批量删除每日感悟
     *
     * @param ids 需要删除的每日感悟主键
     * @return 结果
     */
    @Override
    public int deleteDailyReflectionByIds(Long[] ids)
    {
                return removeByIds(Arrays.asList(ids)) == true ? 1 : 0;
    }

    /**
     * 删除每日感悟信息
     *
     * @param id 每日感悟主键
     * @return 结果
     */
    @Override
    public int deleteDailyReflectionById(Long id)
    {
                return removeById(id) == true ? 1 : 0;
    }
}